package org.example.shop;

public class CarGoods {
    Goods goods;
    int quantity;

    public CarGoods(Goods goods, int quantity) {
        this.goods = goods;
        this.quantity = quantity;
    }

    public CarGoods() {
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {        this.goods = goods;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getTotalPrice() {
        return goods.getRetailPrice() * quantity;
    }

    @Override
    public String toString() {
        return String.format("Product: %s, Quantity: %d, Total Price: %.2f",
                goods.getGoodsName(), quantity, getTotalPrice());
    }
}
